﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PageNsTochuc.aspx.cs" Inherits="DemoExtNet.ModuleNsToChuc.PageNsTochuc" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Assembly="Enterprise" Namespace="Enterprise.Web.Controls" TagPrefix="etc" %>
<%@ Register Src="~/Base/SimpleDetailBase.ascx" TagName="UCSimpleDetailBase" TagPrefix="uc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    
    <link href="../resources/css/main.css" rel="stylesheet" type="text/css" />
    <ext:ResourcePlaceHolder runat="server"></ext:ResourcePlaceHolder>
    <script src="../resources/js/global.js" type="text/javascript"></script>
    <ext:XScript runat="server">
        <script type="text/javascript">
         function Page_ConfirmDeleteToChuc(id) {
            Ext.MessageBox.confirm('Thông báo', 'Bạn có chắc chắn xóa record này ko?', function doDel2(btn) {
                if (btn == 'yes') {
                    #{DirectMethods}.ExecuteGridCommand(3,id);
                }
            });
        }
        </script>
     </ext:XScript>

</head>
<body>
    <form id="form1" runat="server">
    <etc:XResourceManager ID="RemBase" runat="server" />
    <ext:Viewport ID="ViewPortMain" runat="server">
        <Items>
            <ext:BorderLayout ID="BorderLayout1" runat="server">
                <North MinHeight="600">
                    <ext:Panel ID="PnSearch" runat="server" Border="false" Region="North" ButtonAlign="Left"
                        Padding="10" Height="60">
                        <Items>
                            <ext:CompositeField ID="CompositeField1" runat="server">
                                <Items>
                                    <etc:XLookup ID="cboXepHang" runat="server" EmptyText="Chọn xếp hạng" Width="150" SelectMethod="GetXepHangDonVi"
                                        TypeName="Viewer.BusinessObject.BusinessEntities.CommonCode,DemoExtNet" AutoLoad="true" />
                                    <etc:XLookup ID="cboKhoi" runat="server" EmptyText="Chọn khối" Width="150" SelectMethod="GetKhoiQuanlyToChuc"
                                        TypeName="Viewer.BusinessObject.BusinessEntities.CommonCode,DemoExtNet" AutoLoad="true" />
                                    <etc:XLookup ID="cboLoaiToChuc" runat="server" EmptyText="Chọn loại tổ chức" Width="150" SelectMethod="GetLoaiToChuc"
                                        TypeName="Viewer.BusinessObject.BusinessEntities.CommonCode,DemoExtNet" AutoLoad="true" />
                                    <ext:TextField ID="txtTenToChuc" runat="server" EmptyText="Tên Tổ Chức" Width="150">
                                    </ext:TextField>
                                </Items>
                            </ext:CompositeField>
                            <ext:CompositeField ID="CompositeField2" runat="server">
                                <Items>
                                    <ext:Button ID="btnClear1" runat="server" Text="Xóa" Width="60" Icon="Delete">
                                        <Listeners>
                                            <Click Handler="#{cboXepHang}.clear();#{cboKhoi}.clear();#{cboLoaiToChuc}.clear();#{txtTenToChuc}.clear();" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:Button ID="btnSearch" runat="server" Text="Tìm kiếm" Width="60" Icon="Find"
                                        OnDirectClick="btnSearch_Click">
                                    </ext:Button>
                                    <ext:DisplayField ID="DisplayField1" runat="server">
                                    </ext:DisplayField>
                                </Items>
                                <LayoutConfig Pack="End" />
                            </ext:CompositeField>
                        </Items>
                        <KeyMap>
                            <ext:KeyBinding>
                                <Keys>
                                    <ext:Key Code="ENTER" />
                                </Keys>
                                <Listeners>
                                    <Event Handler="#{btnSearch}.fireEvent('Click');" />
                                </Listeners>
                            </ext:KeyBinding>
                        </KeyMap>
                    </ext:Panel>
                </North>
                <Center>
                    <ext:Panel ID="PnGrid" runat="server" Border="false" Region="Center" Layout="AbsoluteLayout">
                        <Items>
                            <etc:XGridPanel runat="server" ID="gridPanel1" Height="400" >
                                <Listeners>
                                    <Command Handler="if(command!='3'){#{DirectMethods}.ExecuteGridCommand(command,record.data.ToChucID);} 
                                                        else {Page_ConfirmDeleteToChuc(record.data.ToChucID);}" />
                                </Listeners>
                            </etc:XGridPanel>
                        </Items>
                    </ext:Panel>
                </Center>
            </ext:BorderLayout>
        </Items>
    </ext:Viewport>
    <uc:UCSimpleDetailBase ID="UCSimpleDetailBase1" runat="server" />
    </form>
</body>
</html>
